/*
 * @Author: 悦者生存 1002783067@qq.com
 * @Date: 2023-11-04 19:43:51
 * @LastEditors: 悦者生存 1002783067@qq.com
 * @LastEditTime: 2023-11-20 22:51:34
 * @FilePath: /login-template/client/src/services/user.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import { LoginResult, User } from '@/interface/login';
import { get, post } from '@/utils/request';

export const getUserList = async () => {
  try {
    const data = await get('/users');
    return data;
  } catch (e: any) {
    return {};
  }
};

export const register = async (params: User) => {
  try {
    const data = await post('/register', params);
    return data;
  } catch (e: any) {
    return {};
  }
};

export const login = async (params: User) => {
  try {
    const data = await post<any, LoginResult>('/login', params);
    return data;
  } catch (e: any) {
    return {};
  }
};
